package user

import (
	"API/client"
	"API/request"
	"API/response"
	"github.com/gin-gonic/gin"
	user "user_server/proto"
)

func LuckyDrawHandler(c *gin.Context) {
	userId := c.GetUint("userId")
	var req request.LuckyDrawRequest
	err := c.ShouldBind(&req)
	if err != nil {
		response.CurrencyErrResponse(c, 400, err.Error())
		return
	}
	res, err := client.UserLuckyDraw(c, &user.LuckyDrawRequest{
		UserId: int32(userId),
	})

	if err != nil {
		response.CurrencyErrResponse(c, 500, err.Error())
		return
	}
	response.CurrencySuccessResponse(c, res.Message, nil)
}
